home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2.sit / Raven 1.2 / Source / Foundation / OS / ZBaseTimer.h < prev    next >
Text File  |  1997-08-02  |  1KB  |  64 lines

  1. /*
  2.  *  File:       ZBaseTimer.h
  3.  *  Summary:       Abstract base class for a mixin that gets periodic time.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->     6/23/96    JDJ        Created
  12.  */
  13.  
  14. #pragma once
  15.  
  16. #include <ZTypes.h>
  17.  
  18.  
  19. // ===================================================================================
  20. //    class MBaseTimer
  21. // ===================================================================================
  22. class MBaseTimer {
  23.  
  24. //-----------------------------------
  25. //    Initialization/Destruction
  26. //
  27. public:
  28.     virtual                   ~MBaseTimer();
  29.                         
  30.     explicit            MBaseTimer(MilliSecond freq, bool running = false);
  31.                         // Frequency is the interval at which the timer wants to be called.
  32.                     
  33. private:
  34.                         MBaseTimer(const MBaseTimer& rhs);
  35.                     
  36.             MBaseTimer& operator=(const MBaseTimer& rhs);
  37.  
  38. //-----------------------------------
  39. //    New API
  40. //
  41. public:
  42.             bool        TimerIsRunning() const            {return mTimerIsRunning;}
  43.  
  44.     virtual void        StartTimer();
  45.     
  46.     virtual void        StopTimer();
  47.                         
  48.             MilliSecond    GetTimerFreq() const            {return mTimerFreq;}
  49.  
  50.     virtual    void        SetTimerFreq(MilliSecond freq);
  51.             
  52. protected:
  53.     virtual    void        OnTime() = 0;
  54.  
  55. //-----------------------------------
  56. //    Data members
  57. //
  58. protected:
  59.     bool            mTimerIsRunning;        
  60.     MilliSecond        mTimerFreq;        
  61. };
  62.  
  63.  
  64.